Texture2D worldDepthTex;
Texture2D particleDepthTex;

sampler TextureSampler : register(s0);

sampler WorldDepthSampler = sampler_state
{ 
    Texture = <worldDepthTex>;
	AddressU = clamp;
	AddressV = clamp;        
}; 

sampler ParticleDepthSampler = sampler_state
{ 
    Texture = <particleDepthTex>;
	AddressU = clamp;
	AddressV = clamp;        
}; 

float4 main(float2 TexCoord : TEXCOORD0) : COLOR0
{
    float4 depthWorld = tex2D(WorldDepthSampler, TexCoord);
	float4 depthParticle = tex2D(ParticleDepthSampler, TexCoord);
	float4 color = tex2D(TextureSampler, TexCoord);

	if(depthWorld.r < depthParticle.r)
		return float4(0,0,0,0);
	return color;
}

technique MultiplyAdd
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 main();
    }
}